import request from '@/utils/request'

// 定义公共的api
const BASE_URL = '/lovePet/system/sysPet';

export default {


  findAll(){
    return request({
      url: `${BASE_URL}/findAllPet`,
      method: 'get',
    })
  },


  //列表
  getPageList(page, limit, searchObj) {
    return request({
      // url: '/admin/system/sysRole/'+page+'/'+limit+'}',
      url: `${BASE_URL}/${page}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  // 添加或者修改
  saveOrUpdate() {
    if (this.sysUser.id != null) {
      this.updateUser();
    } else {
      this.addUser();
    }
  },

  //添加宠物
  savePet(sysPet) {
    return request({
      url: `${BASE_URL}/addPet`,
      method: 'post',
      data: sysPet
    })
  },

  // 修改
  updatePet(sysPet) {
    return request({
      url: `${BASE_URL}/updateSysPet`,
      method: 'post',
      data: sysPet
    })
  },

  // 根据id去得到一个用户
  getSysPetById(id) {
    return request({
      url: `${BASE_URL}/findSysPetById/${id}`,
      method: 'get'
    })
  },


  // 根据id去删除一个用户
  removePetById(id) {
    return request({
      url: `${BASE_URL}/removeSysPetById/${id}`,
      method: 'delete'
    })
  },


  // 根据id获取palyAuth播放凭证
  getPlayAuthById(id){
    return request({
      url:`${BASE_URL}/getPlayAuth/${id}`,
      method: 'get'
    })
  }

}
